﻿package com.wongoing.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wongoing.base.BaseServiceImpl;
import com.wongoing.base.PageResult;
import com.wongoing.sys.dao.SysFeedbackDao;
import com.wongoing.sys.model.SysFeedback;
import com.wongoing.sys.service.SysFeedbackService;

@Service("sysFeedbackService")
@Transactional
public class SysFeedbackServiceImpl extends BaseServiceImpl<SysFeedback> implements SysFeedbackService {
	private SysFeedbackDao dao;

	@Autowired
	public void setDao(SysFeedbackDao dao) {
		super.setDao(dao);
		this.dao = dao;
	}
	
	/**
	 * 功能说明：通过PageResult获取反馈分页数据
	 * 修改说明：
	 * @author 吴兆强
	 * @date 2017年10月13日 下午8:48:15
	 * @param pageResult 分页查询对象，包含查询条件
	 * @return 返回分页查询对象，包含页面数据
	 */
	public PageResult<SysFeedback> getFeedbackListPageResult(PageResult<SysFeedback> pageResult) {
		System.out.println("1234567897");
		pageResult.getParam().put("offset", pageResult.getPageSize() * (pageResult.getPageCurrent() - 1));
		pageResult.getParam().put("limit", pageResult.getPageSize());
		if (!"".equals(pageResult.getOrderField())) { pageResult.getParam().put("orderColumn", pageResult.getOrderField()); }
		pageResult.getParam().put("orderTurn", pageResult.getOrderDirection());
		List<SysFeedback> data = this.dao.getFeedbackListByParam(pageResult.getParam());
		pageResult.setList(data);
		System.out.println("sql语句查询");
		int totalSize = this.dao.countOfFeedbackListByParam(pageResult.getParam());
		pageResult.setTotal(totalSize);
		System.out.println("得到选择的数据"+totalSize);
		return pageResult;
	}
}
